generalize make_windows_release for MinGW or MSVC. (#151)
authortsteven4 <tsteven4@users.noreply.github.com>
Sun, 17 Dec 2017 19:28:18 +0000 (12:28 -0700)
committerGitHub <noreply@github.com>
Sun, 17 Dec 2017 19:28:18 +0000 (12:28 -0700)
make_windows_release.ps1 now can be used with MinGW or MSVC.  It is likely we will have to switch compilers with Qt  >= 5.6 because MinGW is not supported with webengine, and Qt >= 5.6 release packages from www.qt.io distributes webengine and not webkit (although some other parties build webkit from source with these versions of Qt).
appveyor.yml is modified to run a release on one MinGW case (Qt 5.5, webkit) and one MSVC case (Qt 5.6, webengine, 32 bit).  In the case of MSVC the VC redistributible installer is run by setup.
Note that inno setup compiler is always run in 32 bit mode, so if you use this with 64 bit executables they will install in the wrong place, i.e. "Program Files (x86)"

appveyor.yml
gui/app.pro
gui/setup.iss
gui/setup.iss.in
tools/make_windows_release.ps1

index 67c41b7365f3999f8f41fbe646ac31cc8697ebe2..52f5b3b2eb8c0855214d8eccdf54d2542d4f17fe 100644 (file)
@@ -12,11 +12,6 @@ environment:
     platform: mingw
     qt: 5.6\mingw49_32
     tools: mingw492_32
-  # MinGW
-  #  - name: win32
-  #    platform: mingw
-  #    qt: 5.9\mingw53_32
-  #    tools: mingw530_32
   # MSVC x32
   - name: win32
     platform: x86
@@ -35,11 +30,26 @@ init:
 # Flesh out with amd64/msvc cases later.
 build_script:
   - ps: |
+      # be aware that vcvarsall will reset platform amd64 to X64!
+      echo "platform: $env:platform"
+      echo "qt: $env:qt"
+      qmake -query
+      Get-Location
       if (($env:platform -eq "mingw") -and ($env:qt -eq "5.5\mingw492_32"))
       {
-        Get-Location
-        qmake -query
-        & ".\tools\make_windows_release.ps1"
+        # windeployqt in 5.5.1 suffers from bug
+        # https://bugreports.qt.io/browser/QTBUG-48946
+        # which trashes the translations.  Work around
+        # by using the next version of windeployqt which had this
+        # bug fixed.
+        & ".\tools\make_windows_release.ps1" -windeployqt "C:\Qt\5.6\mingw49_32\bin\windeployqt.exe"
+        $sha=(git rev-parse --short HEAD)
+        Get-ChildItem .\gui\release\GPSBabel-*-Setup.exe | % { Push-AppveyorArtifact $_.FullName -FileName "GPSBabelTest-$($env:APPVEYOR_BUILD_VERSION)-$($sha)-Setup.exe" }
+        Get-ChildItem .\gui\release\GPSBabel-*-Manifest.txt | % { Push-AppveyorArtifact $_.FullName -FileName "GPSBabelTest-$($env:APPVEYOR_BUILD_VERSION)-$($sha)-Manifest.txt" }
+      }
+      elseif (($env:platform -eq "x86") -and ($env:qt -eq "5.6\msvc2015"))
+      {
+        & ".\tools\make_windows_release.ps1" -gpsbabel_build_dir_name "build-GPSBabel-Desktop_Qt_5_6_MSVC2015_32bit-Release" -gui_build_dir_name "build-app-Desktop_Qt_5_6_MSVC2015_32bit-Release" -mkspec win32-msvc2015 -mkcmd nmake.exe
         $sha=(git rev-parse --short HEAD)
         Get-ChildItem .\gui\release\GPSBabel-*-Setup.exe | % { Push-AppveyorArtifact $_.FullName -FileName "GPSBabelTest-$($env:APPVEYOR_BUILD_VERSION)-$($sha)-Setup.exe" }
         Get-ChildItem .\gui\release\GPSBabel-*-Manifest.txt | % { Push-AppveyorArtifact $_.FullName -FileName "GPSBabelTest-$($env:APPVEYOR_BUILD_VERSION)-$($sha)-Manifest.txt" }
index 6b57f065b25f781d756014214913ef8709452bfe..9c25674d82b8c4fae80c056ffe83328916701027 100755 (executable)
@@ -46,6 +46,8 @@ RC_FILE = app.rc
 
 win32 { 
   TARGET=GPSBabelFE
+}
+win32-g++ {
   QMAKE_LFLAGS_RELEASE += -static-libgcc
 }
 unix:TARGET=gpsbabelfe-bin
index 30dd4bf238ee33bf95d35d1f84472f812179702a..4b8e163f5be40739885098a2c3b4463be4015e3c 100644 (file)
@@ -7,6 +7,12 @@
 ; Uses the Inno setup compiler.\r
 ; windeployqt should be run to prepare the necessary Qt files before\r
 ; running Inno Setup.\r
+#ifndef gui_build_dir_name\r
+  #define gui_build_dir_name "build-app-Desktop_Qt_5_5_1_MinGW_32bit-Release"\r
+#endif\r
+#ifndef gpsbabel_build_dir_name\r
+  #define gpsbabel_build_dir_name "build-GPSBabel-Desktop_Qt_5_5_1_MinGW_32bit-Release"\r
+#endif\r
 \r
 [Setup]\r
 ; NOTE: The value of AppId uniquely identifies this application.\r
@@ -39,8 +45,10 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
 Source: gmapbase.html;                         DestDir: "{app}"; Flags: ignoreversion\r
 Source: qt.conf;                               DestDir: "{app}"; Flags: ignoreversion\r
 \r
-Source: ..\build-app-Desktop_Qt_5_5_1_Mingw_32bit-Release\release\*; Excludes: "*.cpp,*.o"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs\r
-Source: ..\..\build-GPSBabel-Desktop_Qt_5_5_1_Mingw_32bit-Release\release\gpsbabel.exe;        DestDir: "{app}"; Flags: ignoreversion\r
+Source: "..\{#gui_build_dir_name}\release\*"; Excludes: "app.res,vcredist_*.exe,*.cpp,*.h,*.o,*.obj"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs\r
+Source: "..\{#gui_build_dir_name}\release\vcredist_x86.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall\r
+Source: "..\{#gui_build_dir_name}\release\vcredist_x64.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall\r
+Source: "..\..\{#gpsbabel_build_dir_name}\release\gpsbabel.exe";       DestDir: "{app}"; Flags: ignoreversion\r
 ; Source: release\help\*;              DestDir: "{app}\help"; Flags: ignoreversion recursesubdirs createallsubdirs\r
 \r
 ; Translation strings extracted from source code.  Include it in the dist\r
@@ -66,6 +74,8 @@ Name: "{group}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe"
 Name: "{commondesktop}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe"; Tasks: desktopicon\r
 \r
 [Run]\r
+Filename: "{app}\vcredist_x86.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist\r
+Filename: "{app}\vcredist_x64.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist\r
 Filename: "{app}\gpsbabelfe.exe"; Description: "{cm:LaunchProgram,GPSBabelFE}"; Flags: nowait postinstall skipifsilent\r
 \r
 [Registry]\r
@@ -73,3 +83,5 @@ Root: HKCU; Subkey: "Software\GPSBabel"; Flags: uninsdeletekeyifempty
 Root: HKCU; Subkey: "Software\GPSBabel\GPSBabel"; Flags: uninsdeletekey\r
 Root: HKCU; Subkey: "Software\GPSBabel\GPSBabelFE"; Flags: uninsdeletekey\r
 \r
+; ISPP preprocessor output can be useful for debug\r
+#expr SaveToFile("PreprocessedScript.iss")\r
index 9c9e463dbb0d9301c2e664149a66f855d2ba83b4..f884fee297496f0ed05978e3ffdb3ffa39109174 100755 (executable)
@@ -7,6 +7,12 @@
 ; Uses the Inno setup compiler.\r
 ; windeployqt should be run to prepare the necessary Qt files before\r
 ; running Inno Setup.\r
+#ifndef gui_build_dir_name\r
+  #define gui_build_dir_name "build-app-Desktop_Qt_5_5_1_MinGW_32bit-Release"\r
+#endif\r
+#ifndef gpsbabel_build_dir_name\r
+  #define gpsbabel_build_dir_name "build-GPSBabel-Desktop_Qt_5_5_1_MinGW_32bit-Release"\r
+#endif\r
 \r
 [Setup]\r
 ; NOTE: The value of AppId uniquely identifies this application.\r
@@ -39,8 +45,10 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
 Source: gmapbase.html;                         DestDir: "{app}"; Flags: ignoreversion\r
 Source: qt.conf;                               DestDir: "{app}"; Flags: ignoreversion\r
 \r
-Source: ..\build-app-Desktop_Qt_5_5_1_Mingw_32bit-Release\release\*; Excludes: "*.cpp,*.o"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs\r
-Source: ..\..\build-GPSBabel-Desktop_Qt_5_5_1_Mingw_32bit-Release\release\gpsbabel.exe;        DestDir: "{app}"; Flags: ignoreversion\r
+Source: "..\{#gui_build_dir_name}\release\*"; Excludes: "app.res,vcredist_*.exe,*.cpp,*.h,*.o,*.obj"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs\r
+Source: "..\{#gui_build_dir_name}\release\vcredist_x86.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall\r
+Source: "..\{#gui_build_dir_name}\release\vcredist_x64.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall\r
+Source: "..\..\{#gpsbabel_build_dir_name}\release\gpsbabel.exe";       DestDir: "{app}"; Flags: ignoreversion\r
 ; Source: release\help\*;              DestDir: "{app}\help"; Flags: ignoreversion recursesubdirs createallsubdirs\r
 \r
 ; Translation strings extracted from source code.  Include it in the dist\r
@@ -66,6 +74,8 @@ Name: "{group}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe"
 Name: "{commondesktop}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe"; Tasks: desktopicon\r
 \r
 [Run]\r
+Filename: "{app}\vcredist_x86.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist\r
+Filename: "{app}\vcredist_x64.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist\r
 Filename: "{app}\gpsbabelfe.exe"; Description: "{cm:LaunchProgram,GPSBabelFE}"; Flags: nowait postinstall skipifsilent\r
 \r
 [Registry]\r
@@ -73,3 +83,5 @@ Root: HKCU; Subkey: "Software\GPSBabel"; Flags: uninsdeletekeyifempty
 Root: HKCU; Subkey: "Software\GPSBabel\GPSBabel"; Flags: uninsdeletekey\r
 Root: HKCU; Subkey: "Software\GPSBabel\GPSBabelFE"; Flags: uninsdeletekey\r
 \r
+; ISPP preprocessor output can be useful for debug\r
+#expr SaveToFile("PreprocessedScript.iss")\r
index 2076bba382e9030fb8e43efafd7326e3e1923e4c..6b18dfbccce14b2e38b1cb3ecbcf5c955bd1bd6a 100755 (executable)
@@ -3,16 +3,20 @@
 # Run this from a Qt Desktop command window that has the Qt and mingw compiler paths set up,\r
 # such as the one Qt Creator will put on the start menu.\r
 # For example, to run overriding the default locations of windeployqt and ISSC:\r
-# powershell.exe -ExecutionPolicy Unrestricted -File tools\make_windows_release.ps1 -windeployqt "C:\Qt\5.5\mingw492_32\bin\windeployqt.exe" -iscc "C:\Program Files (x86)\Inno Setup 5\ISCC.exe"\r
+# powershell.exe -ExecutionPolicy Unrestricted -File tools\make_windows_release.ps1 -windeployqt "C:\Qt\5.6.3\mingw49_32\bin\windeployqt.exe" -iscc "C:\Program Files (x86)\Inno Setup 5\ISCC.exe"\r
+# Or to do a 64 bit MSVC build with a newer Qt:\r
+# powershell.exe -ExecutionPolicy Unrestricted -File tools\make_windows_release.ps1 -iscc "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" -gpsbabel_build_dir_name "build-GPSBabel-Desktop_Qt_5_9_3_MSVC2015_64bit-Release" -gui_build_dir_name "build-app-Desktop_Qt_5_9_3_MSVC2015_64bit-Release" -mkspec win32-msvc -mkcmd nmake.exe\r
 #\r
 # Be aware this script is used by appveyor.yml\r
 # \r
-# The defaults should be set for appveyor builds.\r
+# The defaults should be compatible with appveyor builds.\r
 Param(\r
-  $windeployqt =  "C:\Qt\5.6\mingw49_32\bin\windeployqt.exe",\r
+  $windeployqt = "windeployqt.exe",\r
   $iscc = "C:\Program Files (x86)\Inno Setup 5\ISCC.exe",\r
-  $gpsbabel_build_dir_name = "build-GPSBabel-Desktop_Qt_5_5_1_Mingw_32bit-Release",\r
-  $gui_build_dir_name = "build-app-Desktop_Qt_5_5_1_MinGW_32bit-Release"\r
+  $gpsbabel_build_dir_name = "build-GPSBabel-Desktop_Qt_5_5_1_MinGW_32bit-Release",\r
+  $gui_build_dir_name = "build-app-Desktop_Qt_5_5_1_MinGW_32bit-Release",\r
+  $mkspec = "win32-g++",\r
+  $mkcmd = "mingw32-make"\r
 )\r
 # verify we are in the top of the gpsbabel clone\r
 Get-Item tools/make_windows_release.ps1 -ErrorAction Stop\r
@@ -24,10 +28,10 @@ $gui_build_dir = "$($gpsbabel_src_dir)\$($gui_build_dir_name)"
 Remove-Item "$($gpsbabel_build_dir)" -Recurse -ErrorAction Ignore\r
 New-Item "$($gpsbabel_build_dir)" -type directory -force\r
 Set-Location "$($gpsbabel_build_dir)"\r
-qmake "$($gpsbabel_src_dir)\GPSBabel.pro" -spec win32-g++\r
+qmake "$($gpsbabel_src_dir)\GPSBabel.pro" -spec "$($mkspec)"\r
 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
-mingw32-make qmake_all\r
-mingw32-make\r
+& "$($mkcmd)" qmake_all\r
+& "$($mkcmd)"\r
 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
 # copy GPSBabel.exe for use by test_script\r
 Remove-Item "$($gpsbabel_src_dir)\release" -Recurse -ErrorAction Ignore\r
@@ -38,22 +42,17 @@ Set-Location "$($gpsbabel_src_dir)"
 Remove-Item "$($gui_build_dir)" -Recurse -ErrorAction Ignore\r
 New-Item "$($gui_build_dir)" -type directory -force\r
 Set-Location "$($gui_build_dir)"\r
-qmake "$($gpsbabel_src_dir)\gui\app.pro" -spec win32-g++\r
+qmake "$($gpsbabel_src_dir)\gui\app.pro" -spec "$($mkspec)"\r
 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
-mingw32-make qmake_all\r
-mingw32-make\r
+& "$($mkcmd)" qmake_all\r
+& "$($mkcmd)"\r
 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
 lupdate "$($gpsbabel_src_dir)\gui\app.pro"\r
 lrelease "$($gpsbabel_src_dir)\gui\app.pro"\r
-# windeployqt in 5.5.1 suffers from bug\r
-# https://bugreports.qt.io/browser/QTBUG-48946\r
-# which trashes the translations.  Work around\r
-# by using the next version of windeployqt which had this\r
-# bug fixed.\r
 # use --plugindir option to locate the plugins.\r
 & "$($windeployqt)" --verbose 10 --plugindir release\plugins release\GPSBabelFE.exe\r
 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
 Set-Location "$($gpsbabel_src_dir)\gui"\r
-& "$($iscc)" setup.iss\r
+& "$($iscc)" /Dgpsbabel_build_dir_name="$($gpsbabel_build_dir_name)" /Dgui_build_dir_name="$($gui_build_dir_name)" setup.iss\r
 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }\r
 Set-Location "$($gpsbabel_src_dir)"\r